IMoniker - Anti-Moniker Implementation

Anti-monikers are the inverse of the OLE implementations of file, item, and pointer monikers. That is, an anti-moniker composed to the right of a file moniker, item moniker, or pointer moniker composes to nothing.

When To Use

If you re a moniker client, you typically do not need to use anti-monikers. When you need the inverse of a moniker, you should call IMoniker::Inverse4HON_YU. For example, if you need an inverse to remove the last piece of a composite moniker, use IMoniker::Enum18FKHOZ to enumerate the pieces of the moniker and call IMoniker::Inverse on the rightmost piece. You shouldn t use an anti-moniker for this purpose because you can t be sure that the rightmost piece of a composite considers an anti-moniker to be its inverse.

The only situation in which you should explicitly use an anti-moniker is if you are writing a new moniker class and if you have no special requirements for constructing inverses to your monikers. In that situation, you can return anti-monikers from your implementation of IMoniker::Inverse. In your implementation of IMoniker::ComposeWith1M9Y_YZ, you should then annihilate one of your monikers for every anti-moniker you encounter.

Remarks

IMoniker::BindToObject486P_PV

This method is not implemented. It returns E_NOTIMPL.

IMoniker::BindToStorageCA2I.L

This method is not implemented. It returns E_NOTIMPL.

IMoniker::Reduce.M4QZ4

This method returns MK_S_REDUCED_TO_SELF and passes back the same moniker.

IMoniker::ComposeWith1M9Y_YZ

If fOnlyIfNotGeneric is TRUE, this method sets ppmkComposite to NULL moniker and returns MK_E_NEEDGENERIC; otherwise, the method returns the result of combining the two monikers into a generic composite. Note that composing a file, item, or pointer moniker to the right of an anti-moniker produces a generic composite rather than composing to nothing, as would be the case if the order of composition were reversed.

IMoniker::Enum18FKHOZ

This method returns S_OK and sets *ppenumMoniker to NULL.

IMoniker::IsEqualJ2_C.R

This method returns S_OK if both are anti-monikers; otherwise, it returns S_FALSE.

IMoniker::HashF_B.6E

This method calculates a hash value for the moniker.

IMoniker::IsRunning1CR3B7K

This method checks the ROT to see if the object is running.

IMoniker::GetTimeOfLastChange123HWA2

This method is not implemented (that is, it returns E_NOTIMPL).

IMoniker::Inverse4HON_YU

This method returns MK_E_NOINVERSE and sets *ppmk to NULL.

IMoniker::CommonPrefixWithK6I29R

If the other moniker is also an anti-moniker, the method returns MK_S_US and sets ppmkPrefix to this moniker. Otherwise, the method calls the MonikerCommonPrefixWith1N7XSDT function. This function correctly handles the case where the other moniker is a generic composite.

IMoniker::RelativePathTo8ECMZ1

This method returns MK_S_HIM and sets *ppmkRelPath to the other moniker.

IMoniker::GetDisplayName2BE2_IB

For each anti-moniker contained in this moniker, this method return one instance of  \.. 

IMoniker::ParseDisplayNameAU2GHS

This method is not implemented (that is, it returns E_NOTIMPL).

IMoniker::IsSystemMonikerXEHS5E

This method returns S_OK and indicates MKSYS_ANTIMONIKER.

See Also

CreateAntiMoniker, IMoniker